﻿<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Account"
xmlns="http://ibatis.apache.org/mapping/V2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >

  <statements>

    <insert id="InsertAccountViaParameterMap"
               parameterMap="insert-params">
      insert into Accounts
      (Account_ID, Account_FirstName, Account_LastName, Account_Email, Account_Banner_Option, Account_Cart_Option)
      values
      (?, ?, ?, ?, ?, ?)
    </insert>
    
    <select id="SelectAccountConstructor" parameterClass="Integer"
      resultMap="account-result-constructor">
      select *
      from Accounts
      where Account_ID = #value#
    </select>

    <select id="select-account-joined-document" parameterClass="Integer"
     resultMap="account-result-joined-document">
      select *
      from Accounts a, Documents d
      where a.Account_ID = d.Account_ID
      And a.Account_ID = #value#
    </select>

    <select id="GetAccountNullableEmail"
      resultMap="account-result-nullable-email">
      select
      Account_ID,
      Account_FirstName,
      Account_LastName,
      Account_Email
      from Accounts
      where Account_ID = #value#
    </select>
    
  </statements>

</sqlMap>